package com.zhentao.product.controller;

import com.zhentao.nlz.project.dto.VehicleInformationDto;
import com.zhentao.nlz.project.product.TVehicleInformation;
import com.zhentao.product.service.TVehicleInformationService;
import com.zhentao.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("tVehicleInformation")
public class TVehicleInformationController {
    @Autowired
    private TVehicleInformationService tVehicleInformationService;
    @GetMapping("vehicleInformationList")
    public Result vehicleInformationList(VehicleInformationDto vehicleInformationDto){
        return tVehicleInformationService.vehicleInformationList(vehicleInformationDto);
    }
    @PostMapping("vehicleInformationAdd")
    public Result vehicleInformationAdd(TVehicleInformation vehicleInformation){
        vehicleInformation.setCreateTime(new Date());
        return tVehicleInformationService.vehicleInformationAdd(vehicleInformation);
    }
    @PutMapping("vehicleInformationUpdate")
    public Result vehicleInformationUpdate(TVehicleInformation vehicleInformation){
        vehicleInformation.setUpdateTime(new Date());
        return tVehicleInformationService.vehicleInformationUpdate(vehicleInformation);
    }
    @DeleteMapping("vehicleInformationDelete")
    public Result vehicleInformationDelete(@RequestParam("id") Integer id){
        return tVehicleInformationService.vehicleInformationDelete(id);
    }
}
